<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <title>分类管理</title>
    <style type="text/css">
        .plus_minus{
            width: 20px;
        }
    </style>
    <link rel="stylesheet" href="http://localhost/jumei/Static/bootstrap/css/bootstrap.min.css" />
    <!-- <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.min.css"> -->
    <link rel="stylesheet" href="http://localhost/jumei/Static/hdjs/hdjs.css" />
    <script type="text/javascript" src="http://localhost/jumei/Static/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
    $(function(){
        $('tr[pid!=0]').hide();
        $('.glyphicon').toggle(function() {
            $(this).addClass('glyphicon-minus').removeClass('glyphicon-plus');
            var cid = $(this).parents('tr').attr('cid');
            $('tr[pid='+cid+']').fadeIn(500);
        }, function() {
            $(this).addClass('glyphicon-plus').removeClass('glyphicon-minus');
            var cid = $(this).parents('tr').attr('cid');
            $('tr[pid='+cid+']').fadeOut(500);
            // $('tr[pid='+cid+']').find('tr').hide();
        });
        
    })
    </script>
</head>
<body>
<div class="wrap">
    <table class="table table-hover" style="text-align:center">
        <thead>
        <tr style="background:#E6E6E6" pid=0>
            <td width="30"></td>
            <td>分类id</td>
            <td style="text-align:left">分类名称</td>
            <td>分类排序</td>
            <td width="200">操作</td>
        </tr>
        </thead>
        <tbody>
            <?php foreach ($data as $k=>$v){?>
                <tr pid="<?php echo $v['pid'];?>" cid="<?php echo $v['cid'];?>">
                    <td width="30"><span class="glyphicon glyphicon-plus" style="cursor: pointer;"></span></td>
                    <td width="70"><?php echo $v['cid'];?></td>
                    <td width="150" style="text-align:left;text-indent:10px"><?php echo $v['_name'];?></td>
                    <td width="100"><?php echo $v['sort'];?></td>
                    <td>
                        <a href="<?php echo U('Category/add_son',array('pid'=>$v['cid']));?>" class="btn btn-primary btn-sm">添加子分类</a>
                        <a href="<?php echo U('Category/edit',array('cid'=>$v['cid']));?>" class="btn btn-info btn-sm">编辑</a>
                        <a href="javascript:;" class="btn btn-danger btn-sm" onclick="if(confirm('确定删除吗？')) location.href='<?php echo U('Category/del',array('cid'=>$v['cid']));?>'">删除</a>
                    </td>
                </tr>
            <?php }?>
        </tbody>
    </table>
    <div class="page_hdjob">
        
    </div>
</div>
</body>
</html>


